package top.chendawei.system.service;

import top.chendawei.system.enums.CommomOperator;
import top.chendawei.util.JsonResult;

import java.util.List;

public interface ICommonService {

    <T> JsonResult<T> search(List<String> attrNames, List<Object> attrValues, List<CommomOperator> operators, Class<T> paramClass,
                             Integer currentPage, Integer pageSize, String orderBy, String orderType);

    <T> T commonFind(Class<T> paramClass, long id);

    <T> List<T> search(String paramString, Object paramObject, Class<T> paramClass);

    <T> List<T> search(List<String> attrs, List<Object> values, List<CommomOperator> ops, Class<T> paramClass);

    <T> List<T> search(List<String> attrNames, List<Object> attrValues, List<CommomOperator> operators, Class<T> paramClass,
                       String orderBy, String orderType);

    <T> T findOneByAttribute(Class<T> paramClass, String paramString, Object paramObject);

    <T> T findByAttribute(Class<T> paramClass, String paramString, Object paramObject);

    <T> List<T> findByAttributeList(Class<T> type, String attrName, Object val);

    <T> boolean commonDelete(Class<T> type, Long... ids);

    <T> void commonAdd(T paramObject);

    <T> void commonBatchAdd(List<T> ll);

    <T> void commonUpdate(T obj);

    <T> void commonSaveOrUpdate(T obj, Long id);
}
